Main ----- Copyright Up Previous Next

Absolute URIs

Sometimes, when your project starts to become rather complex, you create subdirectories for to structure the whole thing.

As example, I prefer to create a directory image/, where all images for buttons and logos are placed.

Creating a link to an image from the main-directory is no problem, it's URI simply is image/logo.gif.

But if your current page is somewhere deeper in your project-path, eg people/hugo/hugo.html, you need to refer to the same image using ../../image/logo.gif. So you always have to know the directory-level of your current page.

This is not only annoying: Inside a macro, you are not able to find out where the file calling the macro is located!

One solution would be to define a <BASE="[path to main document]">. But then, all your links have to be absolute. This is very annoying if you need to refer to files located in the same directory.

But, thanks to hsc, here's the solution to this problem: if you don't define a <BASE>-URI, all relative links are processed as usual. Only if the URI starts with a colon (":"), it refers to a file relative to the main-path of your project.


Thomas Aglassinger ( agi@giga.or.at ), 15-May-1996